package com.codejam.winter.dal.dao.impl;

import com.codejam.winter.dal.dao.UserMapper;
import com.codejam.winter.dal.dataobject.User;
import com.codejam.winter.util.mybatis.MyBatisUtils;
import org.apache.ibatis.session.SqlSession;
import org.springframework.stereotype.Repository;

/**
 * @author zhaosen
 * @date 2020/2/1
 */
@Repository
public class UserDAOImpl implements UserMapper {

    @Override
    public User getUser() {

        try(SqlSession session = MyBatisUtils.getSession())
        {
            UserMapper mapper = session.getMapper(UserMapper.class);

            User user = mapper.getUser();

            System.out.println(user);

            return user;
        }

    }
}
